home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 November: Tool Chest / Dev.CD Nov 98 TC.toast / Sample Code / Snippets / Networking / ATP Demo 1.0 / ATP Demo.protos < prev    next >
Encoding:
Text File  |  1994-10-28  |  5.0 KB  |  178 lines  |  [TEXT/MPS ]

  1. /*****************************************************************
  2.  
  3.     Program:    < ATP Demo >
  4.     File:        < ATP Demo.protos >
  5.     
  6.     Written by  Scott Kuechle
  7.     of <Apple Macintosh Developer Technical Support>
  8.     
  9.     10/92 SRK created
  10.     8/94 SRK Modified to use a queue of parameter
  11.              blocks.
  12.  
  13.     Copyright © 1992, 1994 Apple Computer, Inc.
  14.     All rights reserved.
  15.     
  16. *****************************************************************/
  17.  
  18.  
  19. #include    <types.h>
  20. #include    <quickdraw.h>
  21. #include    <toolutils.h>
  22. #include    <fonts.h>
  23. #include    <events.h>
  24. #include    <windows.h>
  25. #include    <dialogs.h>
  26. #include    <menus.h>
  27. #include    <desk.h>
  28. #include    <textedit.h>
  29. #include    <scrap.h>
  30. #include    <segload.h>
  31. #include    <osevents.h>
  32. #include    <files.h>
  33. #include    <devices.h>
  34. #include    <memory.h>
  35. #include    <appletalk.h>
  36. #include    <lists.h>
  37. #include    <SysEqu.h>
  38. #include    <Script.h>
  39. #include    <CursorCtl.h>
  40. #include    <Resources.h>
  41. #include    <ADSP.h>
  42. #include    <Packages.h>
  43. #include    <String.h>
  44. #include    <Strings.h>
  45. #include    <Traps.h>
  46. #include    <GestaltEqu.h>
  47. #include    <Errors.h>
  48.  
  49.  
  50. /*****************************************************************/
  51. /*
  52. /* R O U T I N E S
  53. /*
  54. /*****************************************************************/
  55. void     InitQueues();
  56. void CheckDoneQueue();
  57. void CheckRequests();
  58. void     DisplayStatusString(short whichString,Ptr displayStr);
  59. pascal void doGetRequestIOComp(ATPPBPtr atpPBPtr);
  60. void doGetRequest(ATPPBPtr atpPBPtr,
  61.                     char socket,
  62.                     short reqLength,
  63.                     Ptr reqPointer);
  64. pascal void doSndRequestIOComp(ATPPBPtr atpPBPtr);
  65. void doSndRequest(ATPPBPtr         atpPBPtr,
  66.                     AddrBlock     address,
  67.                     char        socket,
  68.                     Ptr         bdsPtr,
  69.                     short         reqLength,
  70.                     Ptr         reqPointer,
  71.                     char         numOfBuffs);
  72. pascal void doSendResponseIOComp(ATPPBPtr atpPBPtr);
  73. void doSendResponse(ATPPBPtr atpPBPtr,
  74.                     char     socket,
  75.                     Ptr        bdsPtr,
  76.                     char    numOfBuffs,
  77.                     char    bdsSize);
  78. Boolean GetASocket(char *socket);
  79. void closeOurSocket(char socket);
  80. Boolean SendReqToTarget();
  81. void     ATPLoop();
  82. void     initializeATP();
  83. void     removeATP();
  84. ATPPBPtr GetQElement(QHdrPtr qHdrPtr);
  85. myATPParamBlockPtr GetOurPBPtr(ATPPBPtr atpPBPtr);
  86. void SetOurCompletionRoutine(ProcPtr procPtr,
  87.                             ATPPBPtr atpPBPtr);
  88. void SendOurResponseData(ATPPBPtr atpPBPtr);
  89. void GetClockTime(Ptr buf);
  90. void SetUpATPError(OSErr err,
  91.                     StringPtr displayStr);
  92. void ShowATPError(ATPPBPtr atpPBPtr);
  93. void ShowClockTime(ATPPBPtr atpPBPtr);
  94. short CopyDataToBDSBuffers(BDSPtr bds,
  95.                             Ptr src,
  96.                             long srcSize);
  97. Boolean VerifyData(myATPParamBlockPtr myATPPbPtr);
  98. void ShowStatusString(StringPtr str);
  99. void SaveFunctionResultCode(OSErr err,
  100.                             ATPPBPtr atpPBPtr);
  101.  
  102. /*****************************************************************/
  103. /*
  104. /* R O U T I N E S
  105. /*
  106. /*****************************************************************/
  107.  
  108. void    Terminate();
  109. void    DoActivate (WindowPtr window, Boolean becomingActive);
  110. void    CheckEnvirons();
  111. void    drawPopUpTri (WindowPtr whichWindow, Rect r);
  112. void     CopyPstr(Ptr pSource, Ptr pDest);
  113. void     PStrCat(Ptr sourceStr, Ptr destinationStr);
  114. void    SetUpATPError(OSErr err, StringPtr displayStr);
  115. void     ShowError(short index);
  116. void     FatalError(error);
  117. Boolean IsAppWindow(window);
  118. Boolean IsDAWindow(WindowPtr window);
  119. void     DoCloseWindow (WindowPtr window);
  120. void     outlinePopUpMenus (WindowPtr whichWindow, Rect r, Str255 itemString);
  121. pascal void UpdateUserItems (WindowPtr whichWindow, short theItem);
  122. void     DoModeless (DialogPtr whichDialog, short whichItem);
  123. void     setEachUserItem (short item);
  124. void     DoMenuCommand (long menuResult);
  125. void     AdjustMenus();
  126. void     DisposeQueueMemory();
  127. void     Exit(short message);
  128. void     DoIdleProc();
  129. void     AdjustCursor (Point mouse, RgnHandle region);
  130. void     UpdateItemBorder (short item, Rect r);
  131. void     PlotSICN (Rect theRect,SICNHand theSICN, short theIndex);
  132. void     DoEvent (EventRecord event);
  133. void     EventLoop();
  134. Boolean TrapAvailable(tNumber,tType);
  135. void     SetupUserItems();
  136. void     InitializeFreeQ();
  137. void     Initialize();
  138. void     DoDrawIcon(Boolean normalState, short item);
  139. void     AdjustResponderIcon();
  140. void     ShowATPError();
  141. void     HiliteSendReqButton (short mode);
  142. void     BuildDataSizePopUp();
  143.  
  144.  
  145.  
  146. /*****************************************************************/
  147. /*
  148. /* R O U T I N E S
  149. /*
  150. /*****************************************************************/
  151.  
  152. void     registerMyName(char socket);
  153. void     removeMyName();
  154. long     myCompare (Str255 aStr, Str255 bStr);
  155. void     letsSort (Ptr theBuffPtr, long numZonesGot);
  156. void     addZonesToBuffer (Ptr LkUpBuffer,
  157.                 Ptr BufferForZoneMenu,
  158.                 short NumZonesGot,
  159.                 short CurrentTotal);
  160. void     parseItemsAddToMenu (Ptr theBuffPtr,
  161.                     MenuHandle zoneMenu,
  162.                     short NumZonesGot);;
  163. Boolean zonesPresent();
  164. void     parseLkupBuffAddToMenu (Ptr theBuffPtr,
  165.                         Ptr bigBuffer,
  166.                         MenuHandle lookupMenu,
  167.                         short NumGot,
  168.                         Boolean doObjects);
  169. void     LookupNames (MenuHandle lookupMenu,
  170.                 Boolean doObjects);
  171. void     BuildZoneListPhase1(MenuHandle zoneMenu);
  172. void     BuildZoneListPhase2(MenuHandle zoneMenu);
  173. void     GetZones(MenuHandle ZoneMenu);
  174. void     getOurZonePhase2();
  175. void     getOurZonePhase1();
  176. OSErr     InitAppleTalk();
  177. void     GetOurZone();
  178.